const mutations = {
  cartList(state, product) {
    // payload.checked = true,
    console.log(product);
    // 1.查看是否添加过
    const oldProduct = state.cartList.find(item => item.iid === product.iid)

    // 2.+1或者新添加
    if (oldProduct) {
      oldProduct.count += 1
    } else {
      product.count = 1
      product.checked = true
      state.cartList.push(product)
    }
  }
}

export default mutations
